package cn.wuxun.sponsor.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.jt.common.pojo.Sponsor;
import com.jt.common.vo.EasyUIResult;

import cn.wuxun.sponsor.mapper.SponsorMapper;
@Service
public class SponsorService {

	@Autowired
	private SponsorMapper sponsorMapper;
	
	public void addSponsor(Sponsor sponsor) {
		sponsorMapper.addSponsor(sponsor);
	}

	public void updateSponsor(Sponsor sponsor) {
		// TODO Auto-generated method stub
		sponsorMapper.updateSponsor(sponsor);
	}

	public Sponsor querySponsorById(int sid) {
		Sponsor sponsor=sponsorMapper.querySponsorById(sid);
		return sponsor;
	}

	public void delSponsor(int sid) {
		sponsorMapper.delSponsor(sid);
		
	}

	public EasyUIResult querySponsorByPage(Integer page, Integer rows) {
		EasyUIResult result=new EasyUIResult();
		Integer total=sponsorMapper.queryTotalCount();
		Integer start=(page-1)*rows;
		List<Sponsor>sponsorList=sponsorMapper.queryByPage(start,rows);
		result.setTotal(total);
		result.setRows(sponsorList);
		return result;
	}

	public List<Sponsor> queryAllSponsor() {
		List<Sponsor>sponsorList=sponsorMapper.queryAllSponsor();
		return sponsorList;
	}

}
